From: Giovanni Campagna Date: Thu, 13 Dec 2012 22:20:46 +0000 (+0100) Subject: ViewSelector: use Params to pass optional parameters to addPage X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~5064 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=c97b4dd48e142ec1c7cc6eab2d62c2a89de7f0b6;p=gnome-shell.git ViewSelector: use Params to pass optional parameters to addPage This allows to introduce new parameters without making the signature overly complex. https://bugzilla.gnome.org/show_bug.cgi?id=690171 --- diff --git a/js/ui/viewSelector.js b/js/ui/viewSelector.js index ba09ae261..1ece4a06c 100644 --- a/js/ui/viewSelector.js +++ b/js/ui/viewSelector.js @@ -12,6 +12,7 @@ const St = imports.gi.St; const AppDisplay = imports.ui.appDisplay; const Main = imports.ui.main; +const Params = imports.misc.params; const RemoteSearch = imports.ui.remoteSearch; const Search = imports.ui.search; const SearchDisplay = imports.ui.searchDisplay; @@ -77,16 +78,17 @@ const ViewSelector = new Lang.Class({ this._capturedEventId = 0; this._workspacesDisplay = new WorkspacesView.WorkspacesDisplay(); - this._workspacesPage = this._addPage(this._workspacesDisplay.actor, null, + this._workspacesPage = this._addPage(this._workspacesDisplay.actor, _("Windows"), 'emblem-documents-symbolic'); this._appDisplay = new AppDisplay.AllAppDisplay(); - this._appsPage = this._addPage(this._appDisplay.actor, null, + this._appsPage = this._addPage(this._appDisplay.actor, _("Applications"), 'view-grid-symbolic'); this._searchResults = new SearchDisplay.SearchResults(this._searchSystem); - this._searchPage = this._addPage(this._searchResults.actor, this._entry, - _("Search"), 'edit-find-symbolic'); + this._searchPage = this._addPage(this._searchResults.actor, + _("Search"), 'edit-find-symbolic', + { a11yFocus: this._entry }); this._searchSettings = new Gio.Settings({ schema: Search.SEARCH_PROVIDERS_SCHEMA }); this._searchSettings.connect('changed::disabled', Lang.bind(this, this._reloadRemoteProviders)); @@ -169,14 +171,16 @@ const ViewSelector = new Lang.Class({ this._workspacesDisplay.hide(); }, - _addPage: function(actor, a11yFocus, name, a11yIcon) { + _addPage: function(actor, name, a11yIcon, params) { + params = Params.parse(params, { a11yFocus: null }); + let page = new St.Bin({ child: actor, x_align: St.Align.START, y_align: St.Align.START, x_fill: true, y_fill: true }); - if (a11yFocus) - Main.ctrlAltTabManager.addGroup(a11yFocus, name, a11yIcon); + if (params.a11yFocus) + Main.ctrlAltTabManager.addGroup(params.a11yFocus, name, a11yIcon); else Main.ctrlAltTabManager.addGroup(actor, name, a11yIcon, { proxy: this.actor,